<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class PastHistory extends Model
{
    protected $table = 'st_medical_illnesshistory';

    protected $fillable = [
        'record_id', 'fat', 'hypertension', 'coronary_disease', 'hyperuricemia', 'hyperlipidemia', 'fatty_liver',
        'hepatitis', 'pancreatitis', 'pancreatic_operation', 'renal', 'cerebral_infarction', 'transfusion',
        'irritability', 'special_irritability', 'adverse_drug_reaction', 'thyroid', 'trauma','contagion',
        'extra', 'medication', 'other', 'operation', 'remark', 'pcos'
    ];

    protected $casts = [
        'fat'                   => 'array',
        'hypertension'          => 'array',
        'coronary_disease'      => 'array',
        'hyperuricemia'         => 'array',
        'hyperlipidemia'        => 'array',
        'fatty_liver'           => 'array',
        'hepatitis'             => 'array',
        'pancreatitis'          => 'array',
        'pancreatic_operation'  => 'array',
        'renal'                 => 'array',
        'cerebral_infarction'   => 'array',
        'transfusion'           => 'array',
        'irritability'          => 'array',
        'special_irritability'  => 'array',
        'adverse_drug_reaction' => 'array',
        'thyroid'               => 'array',
        'trauma'                => 'array',
        'contagion'             => 'array',
        'extra'                 => 'array',
        'medication'            => 'array',
        'other'                 => 'array',
        'operation'             => 'array',
        'pcos'                  => 'array',
    ];

    //  关联
    public function medicalRecord()
    {
        return $this->belongsTo(MedicalRecord::class, 'record_id');
    }
}
